package Manejador;

use strict;
use warnings;
binmode(STDOUT, ":utf8");

my %tr = (micasa => "myhouse", habitacion=>"room", mueble => "forniture", puerta=>"door");

sub new {
    my ($tipo) = @_;
    return bless {}, $tipo;
}

sub start_element {
  my ($self, $item) = @_;
  if ($item->{Attributes}->{id}) {
    print "<".$tr{$item->{Name}}." id="."\"$item->{Attributes}->{id}\">";
  } elsif ($item->{Attributes}->{a}) {
    print "<".$tr{$item->{Name}}." a="."\"$item->{Attributes}->{a}\">";
  } else {
    print "<".$tr{$item->{Name}}.">";  
  }
}

sub end_element {
  my ($self, $item) = @_;

  print "</".$tr{$item->{Name}}.">";
}

sub characters {
  my ($self, $item) = @_;

  print $item->{Data};
}

1;
